/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-17 11:39:54
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-18 06:48:20
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/components/animation_text.dart';
import 'package:flutter_data_center/model/door/door_model.dart';
import 'package:flutter_data_center/utills/color_utils.dart';
import 'package:flutter_data_center/utills/navigator_utils.dart';
import 'package:flutter_svg/flutter_svg.dart';

import '../../../../constants.dart';
import '../../detail/door_detail_screen.dart';

class DoorItem extends StatelessWidget {
  const DoorItem({Key key, this.door}) : super(key: key);
  final DoorModel door;

  @override
  Widget build(BuildContext context) => Column(
        children: [
          InkWell(
            borderRadius: BorderRadius.circular(15),
            splashColor: Theme.of(context).primaryColor,
            onTap: () {
              NavigatorUtils.pushPageByFade(
                context: context,
                targetPage: DoorDetailScreen(title: door.name),
                isReplace: false,
              );
            },
            child: Container(
              width: double.infinity,
              height: 100,
              padding: EdgeInsets.only(
                left: 20,
                right: 14,
              ),
              decoration: BoxDecoration(
                color: Colors.white.withOpacity(0.9),
                borderRadius: BorderRadius.circular(15),
                boxShadow: [
                  BoxShadow(
                    offset: Offset(0, 0),
                    blurRadius: 30,
                    color: Color.fromRGBO(0, 0, 0, 0.08),
                  ),
                ],
              ),
              child: Row(
                children: [
                  Container(
                    padding: EdgeInsets.all(defaultPadding),
                    width: 60,
                    height: 60,
                    decoration: BoxDecoration(
                      color: gColor(door.color),
                      borderRadius: BorderRadius.circular(15),
                    ),
                    child: SvgPicture.asset(
                      "assets/icon/icon_door.svg",
                      color: gColor("#333333"),
                    ),
                  ),
                  SizedBox(width: 13),
                  Expanded(
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text(
                          door.name,
                          style: TextStyle(
                            fontSize: 24,
                            fontWeight: FontWeight.w500,
                          ),
                        ),
                        SizedBox(height: 7),
                        Row(
                          children: [
                            Text(
                              "进出",
                              style: TextStyle(
                                fontSize: 14,
                                fontWeight: FontWeight.w500,
                                color: gColor("#8F8F8F"),
                              ),
                            ),
                            SizedBox(width: 13),
                            AnimText(
                              number: door.count,
                              style: TextStyle(
                                fontSize: 14,
                                fontWeight: FontWeight.w500,
                              ),
                            ),
                          ],
                        ),
                      ],
                    ),
                  ),
                  Container(
                    alignment: Alignment.center,
                    width: 39,
                    height: 21,
                    decoration: BoxDecoration(
                      color: gColor("#03FFC3"),
                      borderRadius: BorderRadius.circular(15),
                    ),
                    child: Text(
                      "正常",
                      style: TextStyle(
                        fontSize: 12,
                        height: 1,
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
          SizedBox(height: 33),
        ],
      );
}
